************************************************
** May 20, 2014                               **
** HEEDING THE SIRENS                         **
** Irfan Nooruddin & Byungwon Woo             **
************************************************

/*
Note: This file is intended for use with "NooruddinWoo.Replication data file.dta" and 
replicates all results reported in our paper "Heeding the Sirens: The Politics of IMF
Program Participation", which has been accepted for publication in Political Science 
Research \& Methods.
*/


*********************************************************************************************
*********************************************************************************************
*********************************************************************************************

tsset cowcode year
/*
OUTPUT SHOULD LOOK LIKE THIS:
       panel variable:  cowcode (unbalanced)
        time variable:  year, 1970 to 2006
                delta:  1 unit
*/

**** ANALYSES CONTAINED IN MAIN PAPER

** TABLE 1
set more off

logit signed_imf polity2_di CurrentAccBal_percentGDP gdppc1000 lngdp s2uni l.numberunder l.imf_years /*
*/ if l.underimf==0&concessional==0, cluster(countrycode)
estimates store CABNoIMFt1
fitstat
logit signed_imf polity2_di CurrentAccBal_percentGDP gdppc1000 lngdp s2uni l.numberunder l.imf_years /*
*/ if l.underimf==1&concessional==0, cluster(countrycode)
estimates store CABUnderIMFt1
fitstat

logit signed_imf polity2_di reserves_mths gdppc1000 lngdp s2uni l.numberunder l.imf_years /*
*/ if l.underimf==0&concessional==0, cluster(countrycode)
estimates store RESNoIMFt1
fitstat
logit signed_imf polity2_di reserves_mths gdppc1000 lngdp s2uni l.numberunder l.imf_years /*
*/ if l.underimf==1&concessional==0, cluster(countrycode)
estimates store RESUnderIMFt1
fitstat

logit signed_imf polity2_di debtserv_exports gdppc1000 lngdp s2uni l.numberunder l.imf_years /*
*/ if l.underimf==0&concessional==0, cluster(countrycode)
estimates store DEBTNoIMFt1
fitstat
logit signed_imf polity2_di debtserv_exports gdppc1000 lngdp s2uni l.numberunder l.imf_years /*
*/ if l.underimf==1&concessional==0, cluster(countrycode)
estimates store DEBTUnderIMFt1
fitstat

logit signed_imf polity2_di grw_neg gdppc1000 lngdp s2uni l.numberunder l.imf_years /*
*/ if l.underimf==0&concessional==0, cluster(countrycode)
estimates store NEGNoIMFt1
fitstat
logit signed_imf polity2_di grw_neg gdppc1000 lngdp s2uni l.numberunder l.imf_years /*
*/ if l.underimf==1&concessional==0, cluster(countrycode)
estimates store NEGUnderIMFt1
fitstat

estimates table CABNoIMFt1 CABUnderIMFt1 RESNoIMFt1 RESUnderIMFt1 DEBTNoIMFt1 DEBTUnderIMFt1 NEGNoIMFt1 NEGUnderIMFt1, /*
 */ b(%10.2f) se(%10.2f) p(%10.2f) stats(N ll aic bic) /*
 */ keep(polity2_di CurrentAccBal_percentGDP reserves_mths debtserv_exports grw_neg gdppc1000 lngdp s2uni l.numberunder l.imf_years /*
 */  _cons) 

/*
estout CABNoIMFt1 CABUnderIMFt1 RESNoIMFt1 RESUnderIMFt1 DEBTNoIMFt1 DEBTUnderIMFt1 NEGNoIMFt1 NEGUnderIMFt1 /*
*/ , /*
*/ style(tex) varlabels(_cons Constant) label legend starl(* 0.10 ** 0.05 *** 0.01) /*
*/ cells(b(label(Coef.) star fmt(%9.2f)) se(par fmt(%9.2f))) stats(N aic bic, labels("N" "AIC" "BIC")) /*
*/ title(Baseline Models of IMF Participation\label{baseline}) /*
*/ mlabels(, span prefix(\multicolumn{@span}{c}{) suffix(})) /*
*/ prehead("\begin{table}\caption{@title}" "\begin{center}" /*
*/ "\begin{tabular}{l*{@M}{rr}}" "\hline") posthead(\hline) /*
*/ prefoot(\hline) postfoot("\hline" /*
*/ "\end{tabular}" "\end{center}" "\end{table}")
*/

** TABLE 2
set more off

logit signed_imf polity2_di CurrentAccBal_percentGDP polity2diXcurrentacc gdppc1000 lngdp s2uni l.numberunder l.imf_years /*
*/ if l.underimf==0&concessional==0, cluster(countrycode)
estimates store CABNoIMFt1
fitstat
logit signed_imf polity2_di CurrentAccBal_percentGDP polity2diXcurrentacc gdppc1000 lngdp s2uni l.numberunder l.imf_years /*
*/ if l.underimf==1&concessional==0, cluster(countrycode)
estimates store CABUnderIMFt1
fitstat

logit signed_imf polity2_di reserves_mths polity2diXresmths gdppc1000 lngdp s2uni l.numberunder l.imf_years /*
*/ if l.underimf==0&concessional==0, cluster(countrycode)
estimates store RESNoIMFt1
fitstat
logit signed_imf polity2_di reserves_mths polity2diXresmths gdppc1000 lngdp s2uni l.numberunder l.imf_years /*
*/ if l.underimf==1&concessional==0, cluster(countrycode)
estimates store RESUnderIMFt1
fitstat

logit signed_imf polity2_di debtserv_exports polity2diXdebtserv gdppc1000 lngdp s2uni l.numberunder l.imf_years /*
*/ if l.underimf==0&concessional==0, cluster(countrycode)
estimates store DEBTNoIMFt1
fitstat
logit signed_imf polity2_di debtserv_exports polity2diXdebtserv gdppc1000 lngdp s2uni l.numberunder l.imf_years /*
*/ if l.underimf==1&concessional==0, cluster(countrycode)
estimates store DEBTUnderIMFt1
fitstat

logit signed_imf polity2_di grw_neg polity2diXgrwneg gdppc1000 lngdp s2uni l.numberunder l.imf_years /*
*/ if l.underimf==0&concessional==0, cluster(countrycode)
estimates store NEGNoIMFt1
fitstat
logit signed_imf polity2_di grw_neg polity2diXgrwneg gdppc1000 lngdp s2uni l.numberunder l.imf_years /*
*/ if l.underimf==1&concessional==0, cluster(countrycode)
estimates store NEGUnderIMFt1
fitstat

estimates table CABNoIMFt1 CABUnderIMFt1 RESNoIMFt1 RESUnderIMFt1 DEBTNoIMFt1 DEBTUnderIMFt1 NEGNoIMFt1 NEGUnderIMFt1, /*
 */ b(%10.2f) se(%10.2f) p(%10.2f) stats(N ll aic bic) /*
 */ keep(polity2_di CurrentAccBal_percentGDP polity2diXcurrentacc reserves_mths polity2diXresmths debtserv_exports polity2diXdebtserv  /*
 */ grw_neg polity2diXgrwneg gdppc1000 lngdp s2uni l.numberunder l.imf_years _cons)

 /*
estout CABNoIMFt1 CABUnderIMFt1 RESNoIMFt1 RESUnderIMFt1 DEBTNoIMFt1 DEBTUnderIMFt1 NEGNoIMFt1 NEGUnderIMFt1 /*
*/ , /*
*/ style(tex) varlabels(_cons Constant) label legend starl(* 0.10 ** 0.05 *** 0.01) /*
*/ cells(b(label(Coef.) star fmt(%9.2f)) se(par fmt(%9.2f))) stats(N aic bic, labels("N" "AIC" "BIC")) /*
*/ title(Conditional Models of IMF Participation\label{interaction}) /*
*/ mlabels(, span prefix(\multicolumn{@span}{c}{) suffix(})) /*
*/ prehead("\begin{table}\caption{@title}" "\begin{center}" /*
*/ "\begin{tabular}{l*{@M}{cc}}" "\hline") posthead(\hline) /*
*/ prefoot(\hline) postfoot("\hline" /*
*/ "\end{tabular}" "\end{center}" "\end{table}")
*/

** TABLE 3: SUBSTANTIVE EFFECTS
xi: logit signed_imf c.CurrentAccBal_percentGDP#polity2_di gdppc1000 lngdp s2uni l.numberunder l.imf_years /*
*/ if l.underimf==0&concessional==0, cluster(countrycode)
margins, dydx(CurrentAccBal_percentGDP) at((mean) _all polity2_di=(0 1))
xi: logit signed_imf c.CurrentAccBal_percentGDP#polity2_di gdppc1000 lngdp s2uni l.numberunder l.imf_years /*
*/ if l.underimf==1&concessional==0, cluster(countrycode)
margins, dydx(CurrentAccBal_percentGDP) at((mean) _all polity2_di=(0 1))


xi: logit signed_imf c.reserves_mths#polity2_di gdppc1000 lngdp s2uni l.numberunder l.imf_years /*
*/ if l.underimf==0&concessional==0, cluster(countrycode)
margins, dydx(reserves_mths) at((mean) _all polity2_di=(0 1))
xi: logit signed_imf c.reserves_mths#polity2_di gdppc1000 lngdp s2uni l.numberunder l.imf_years /*
*/ if l.underimf==1&concessional==0, cluster(countrycode)
margins, dydx(reserves_mths) at((mean) _all polity2_di=(0 1))


xi: logit signed_imf c.debtserv_exports#polity2_di gdppc1000 lngdp s2uni l.numberunder l.imf_years /*
*/ if l.underimf==0&concessional==0, cluster(countrycode)
margins, dydx(debtserv_exports) at((mean) _all polity2_di=(0 1))
xi: logit signed_imf c.debtserv_exports#polity2_di gdppc1000 lngdp s2uni l.numberunder l.imf_years /*
*/ if l.underimf==1&concessional==0, cluster(countrycode)
margins, dydx(debtserv_exports) at((mean) _all polity2_di=(0 1))


xi: logit signed_imf grw_neg#polity2_di gdppc1000 lngdp s2uni l.numberunder l.imf_years /*
*/ if l.underimf==0&concessional==0, cluster(countrycode)
margins, dydx(grw_neg) at((mean) _all polity2_di=(0 1))
xi: logit signed_imf grw_neg#polity2_di gdppc1000 lngdp s2uni l.numberunder l.imf_years /*
*/ if l.underimf==1&concessional==0, cluster(countrycode)
margins, dydx(grw_neg) at((mean) _all polity2_di=(0 1))


** TABLE 4: ELECTION YEAR
set more off

logit signed_imf grw_neg gdppc1000 lngdp s2uni l.numberunder l.imf_years /*
*/ electionyear electionyearXgrwneg if l.underimf==0&concessional==0&polity2_di==1, cluster(countrycode)
estimates store NEG1NoIMFt1
fitstat
logit signed_imf grw_neg gdppc1000 lngdp s2uni l.numberunder l.imf_years /*
*/ electionyear electionyearXgrwneg if l.underimf==1&concessional==0&polity2_di==1, cluster(countrycode)
estimates store NEG1UnderIMFt1
fitstat

logit signed_imf grw_neg gdppc1000 lngdp s2uni l.numberunder l.imf_years /*
*/ electionnear electionnearXgrwneg if l.underimf==0&concessional==0&polity2_di==1, cluster(countrycode)
estimates store NEG2NoIMFt1
fitstat
logit signed_imf grw_neg gdppc1000 lngdp s2uni l.numberunder l.imf_years /*
*/ electionnear electionnearXgrwneg if l.underimf==1&concessional==0&polity2_di==1, cluster(countrycode)
estimates store NEG2UnderIMFt1
fitstat

estimates table NEG1NoIMFt1 NEG1UnderIMFt1 NEG2NoIMFt1 NEG2UnderIMFt1, /*
 */ b(%10.2f) se(%10.2f) p(%10.2f) stats(N ll aic bic) /*
 */ keep(grw_neg electionyear electionyearXgrwneg electionnear electionnearXgrwneg gdppc1000 lngdp s2uni l.numberunder l.imf_years /*
 */  _cons)

 /*
estout NEG1NoIMFt1 NEG1UnderIMFt1 NEG2NoIMFt1 NEG2UnderIMFt1 /*
*/ , /*
*/ style(tex) varlabels(_cons Constant) label legend starl(* 0.10 ** 0.05 *** 0.01) /*
*/ cells(b(label(Coef.) star fmt(%9.2f)) se(par fmt(%9.2f))) stats(N aic bic, labels("N" "AIC" "BIC")) /*
*/ title(Elections and IMF Participation\label{election}) /*
*/ mlabels(, span prefix(\multicolumn{@span}{c}{) suffix(})) /*
*/ prehead("\begin{table}\caption{@title}" "\begin{center}" /*
*/ "\begin{tabular}{l*{@M}{rr}}" "\hline") posthead(\hline) /*
*/ prefoot(\hline) postfoot("\hline" /*
*/ "\end{tabular}" "\end{center}" "\end{table}")
*/

** FIGURE 1: PREDICTED PROBABILIYT OF IMF PROGRAM ENTRY (3-DIMENSIONAL)

/* Created in Scientific Workplace using predictions from models presented in Appendix 3 below */



** APPENDIX 2: SUMMARY TABLE

desc signed_imf underimf concessional polity2_di electionyear electionnear grw_neg /*
*/ CurrentAccBal_percentGDP reserves_mths debtserv_exports gdppc1000 lngdp s2uni numberunder imf_years 

summ signed_imf underimf concessional polity2_di electionyear electionnear grw_neg /*
*/ CurrentAccBal_percentGDP reserves_mths debtserv_exports gdppc1000 lngdp s2uni numberunder imf_years /*
*/ if year>=1970&year<=2006

sutex signed_imf underimf concessional polity2_di electionyear electionnear grw_neg /*
*/ CurrentAccBal_percentGDP reserves_mths debtserv_exports gdppc1000 lngdp s2uni numberunder imf_years /*
*/ if year>=1970&year<=2006, minmax labels dig(2)


** APPENDIX 3: REDUCED INTERACTION MODELS

logit signed_imf polity2_di grw_neg polity2diXgrwneg CurrentAccBal_percentGDP reserves_mths debtserv_exports /*
*/ gdppc1000 lngdp s2uni l.numberunder l.imf_years /*
*/ if lagunderimf==0&concessional==0, cluster(countrycode)
est store reduced1

logit signed_imf polity2_di grw_neg polity2diXgrwneg CurrentAccBal_percentGDP reserves_mths debtserv_exports /*
*/ gdppc1000 lngdp s2uni l.numberunder l.imf_years /*
*/ if lagunderimf==1&concessional==0, cluster(countrycode)
est store reduced2

estimates table reduced1 reduced2, /*
 */ b(%10.2f) se(%10.2f) p(%10.2f) stats(N ll aic bic) /*
 */ keep(polity2_di grw_neg polity2diXgrwneg CurrentAccBal_percentGDP reserves_mths debtserv_exports /*
*/ gdppc1000 lngdp s2uni l.numberunder l.imf_years /*
 */  _cons)

/*
estout reduced1 reduced2 /*
*/ , /*
*/ style(tex) varlabels(_cons Constant) label legend starl(* 0.10 ** 0.05 *** 0.01) /*
*/ cells(b(label(Coef.) star fmt(%9.2f)) se(par fmt(%9.2f))) stats(N aic bic, labels("N" "AIC" "BIC")) /*
*/ title(Reduced Interaction Models\label{reduced}) /*
*/ mlabels(, span prefix(\multicolumn{@span}{c}{) suffix(})) /*
*/ prehead("\begin{table}\caption{@title}" "\begin{center}" /*
*/ "\begin{tabular}{l*{@M}{rr}}" "\hline") posthead(\hline) /*
*/ prefoot(\hline) postfoot("\hline" /*
*/ "\end{tabular}" "\end{center}" "\end{table}")
*/

*********************************************************************************************
*********************************************************************************************
*********************************************************************************************

***** MODELS REPORTED IN SUPPLEMENTARY MATERIALS

** TABLE A1: USING ALTERNATIVE OPERATIONALIZATIONS OF DEMOCRACY

* POLITY 2 (CONTINUOUS)
logit signed_imf polity2 grw_neg polity2Xgrwneg /*
*/ gdppc1000 lngdp s2uni l.numberunder l.imf_years /*
*/ if l.underimf==0&concessional==0, cluster(countrycode)

* FREEDOM HOUSE (BINARY)
logit signed_imf pn_FHFree grw_neg pn_FHFreeXgrwneg /*
*/ gdppc1000 lngdp s2uni l.numberunder l.imf_years /*
*/ if l.underimf==0&concessional==0, cluster(countrycode)

* CHEIBUB/GANDHI (BINARY)
logit signed_imf pn_CDem grw_neg pn_cdemXgrwneg /*
*/ gdppc1000 lngdp s2uni l.numberunder l.imf_years /*
*/ if l.underimf==0&concessional==0, cluster(countrycode)

* BOIX ET AL. (BINARY)
logit signed_imf bmr_democracy grw_neg bmr_demXgrwneg /*
*/ gdppc1000 lngdp s2uni l.numberunder l.imf_years /*
*/ if l.underimf==0&concessional==0, cluster(countrycode)


** TABLE A2: CONTROLING FOR VETO PLAYERS USING DPI CHECKS VARIABLE
logit signed_imf polity2_di grw_neg polity2diXgrwneg ln_checks ln_checks_sq gdppc1000 lngdp s2uni l.numberunder l.imf_years /*
*/ if l.underimf==0&concessional==0, cluster(countrycode)

logit signed_imf polity2_di grw_neg polity2diXgrwneg ln_checks ln_checks_sq gdppc1000 lngdp s2uni l.numberunder l.imf_years /*
*/ if l.underimf==1&concessional==0, cluster(countrycode)


** TABLE A3: SEPARATING THE SAMPLE BY INCOME THRESHOLD

logit signed_imf polity2_di grw_neg polity2diXgrwneg reserves_mths debtserv_exports gdppc1000 lngdp s2uni l.numberunder l.imf_years /*
*/ if l.underimf==0&gdppc1000<=.7, cluster(countrycode)

logit signed_imf polity2_di grw_neg polity2diXgrwneg reserves_mths debtserv_exports gdppc1000 lngdp s2uni l.numberunder l.imf_years /*
*/ if l.underimf==0&gdppc1000>=.7, cluster(countrycode)


** TABLE A4: CONDITIONAL LOGIT (FIXED EFFECTS) RESULTS

clogit signed_imf polity2_di grw_neg polity2diXgrwneg gdppc1000 lngdp s2uni lagnumberunder lagimfyears /*
*/ if lagunderimf==0&concessional==0, group(countrycode)

clogit signed_imf polity2_di grw_neg polity2diXgrwneg gdppc1000 lngdp s2uni lagnumberunder lagimfyears /*
*/ if lagunderimf==1&concessional==0, group(countrycode)


*********************************************************************************************
*********************************************************************************************
*********************************************************************************************


** FOOTNOTE 9: TESTING FOR NON-LINEARITY
set more off
xi: logit signed_imf c.polity2##c.polity2 gdppc1000 lngdp s2uni l.numberunder l.imf_years /*
*/ if l.underimf==1&concessional==0, cluster(countrycode)
margins, dydx(polity2) at((mean) _all polity2=(-10 (1) 10))
marginsplot

xi: logit signed_imf c.polity2##c.polity2##grw_neg gdppc1000 lngdp s2uni l.numberunder l.imf_years ln_checks ln_checks_sq /*
*/ if l.underimf==1&concessional==0, cluster(countrycode)
margins, dydx(grw_neg) at((mean) _all polity2=(-10 (1) 10))
marginsplot
margins, dydx(polity2) at((mean) _all grw_neg=(0 1))
marginsplot



*********************************************************************************************
*********************************************************************************************
*********************************************************************************************

drop _est_*

save, replace

 

